package spring.test;

import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import spring.pojo.Dept;
import spring.pojo.Emp;
import spring.pojo.Father;
import spring.pojo.Son;

public class test {
    @Test
    public void get(){
        ClassPathXmlApplicationContext spring =
                new ClassPathXmlApplicationContext("spring_config.xml");
        Emp e = (Emp) spring.getBean("emp");
        Dept d = (Dept) spring.getBean("dept");
        e.working();
        d.work();
        System.out.println(e);
        System.out.println(d);
    }
    @Test
    public void get1(){
        ClassPathXmlApplicationContext spring =
                new ClassPathXmlApplicationContext("spring_config.xml");
        Father f = (Father) spring.getBean("f");
        Son s = (Son)spring.getBean("son");
//        Object o = spring.getBean("org.springframework.context.event.internalEventListenerFactory");
        Object f2 = spring.getBean("f");
        f.meat();
        System.out.println(f2);
//        System.out.println(f);
//        s.play();
        System.out.println(s);
    }
}
